package JVM;

import javafx.scene.layout.Priority;

/**
 * @author:谢君臣
 * @Date:2021/10/20-13:45
 * @version:1.0
 * @function:
 * -Xmx15m
 * -Xms15m
 * -Xmn5m
 * -XX:+DoEscapeAnalysis  // 逃逸分析
 * -XX:+PrintGCDetails   // 打印GC信息
 * -XX:+EliminateAllocations   // 表量替换
 * -XX:+HandlePromotionFailure  // 空间担保机制
 */
public class 内存分配_逃逸分析 {
    public static void main(String[] args) {
        for (int i = 0; i < 1000000000; i++) {
            alloc();
        }
    }

    private static void alloc() {
        Person person = new Person();
        person.id = 1L;
        person.name = "张三";
        person.age = 18;
    }
    static class Person{
        long id;
        String name;
        int age;

        public Person() {
        }
    }

}
